package com.cencat.framework.file.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 文件存储配置类
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "file.storage")
public class FileStorageConfig {
    
    /**
     * 默认存储类型
     */
    private String defaultStorageType = "LOCAL";
    
    /**
     * 最大文件大小（MB）
     */
    private long maxFileSize = 100;
    
    /**
     * 允许的文件类型
     */
    private String[] allowedFileTypes = {
        "jpg", "jpeg", "png", "gif", "bmp", // 图片
        "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", // 文档
        "txt", "log", "csv", // 文本
        "mp4", "avi", "mov", "wmv", // 视频
        "mp3", "wav", "flac" // 音频
    };
    
    /**
     * 临时文件过期时间（小时）
     */
    private int temporaryFileExpireHours = 24;
    
    /**
     * 本地存储配置
     */
    private LocalStorageConfig local = new LocalStorageConfig();
    
    /**
     * MinIO存储配置
     */
    private MinioStorageConfig minio = new MinioStorageConfig();
    
    /**
     * 阿里云OSS配置
     */
    private AliyunOssConfig aliyunOss = new AliyunOssConfig();
    
    /**
     * 腾讯云COS配置
     */
    private TencentCosConfig tencentCos = new TencentCosConfig();
    
    @Data
    public static class LocalStorageConfig {
        private String basePath = "uploads";
        private String urlPrefix = "/files";
    }
    
    @Data
    public static class MinioStorageConfig {
        private String endpoint;
        private String accessKey;
        private String secretKey;
        private String bucketName;
        private String region;
    }
    
    @Data
    public static class AliyunOssConfig {
        private String endpoint;
        private String accessKeyId;
        private String accessKeySecret;
        private String bucketName;
        private String region;
    }
    
    @Data
    public static class TencentCosConfig {
        private String region;
        private String secretId;
        private String secretKey;
        private String bucketName;
        private String appId;
    }
}